home *** CD-ROM | disk | FTP | other *** search
- ; This sample shows the
- ; use of keyboard functions.
- ; Try typing something to
- ; "User Screen".
- ;
- ; When "step delay" is too
- ; long, keyboard buffer
- ; is used.
- ;
- ; Try setting "step delay"
- ; to 1, for more realistic
- ; emulation.
- ;
- ; This code will loop until
- ; you press ESC key, other
- ; keys will be printed.
-
-
- #make_COM#
-
- ; Used to print a message:
- include 'emu8086.inc'
-
- ORG 100h
-
- ; Print a welcome message:
- LEA SI, msg1
- CALL print_string
-
- ;============================
- ; Eternal loop to get
- ; and print keys:
-
- wait_for_key:
-
- ; check for keystroke in
- ; keyboard buffer:
- MOV AH, 1
- INT 16h
- JZ wait_for_key
-
- ; get keystroke from keyboard:
- ; (remove from the buffer)
- MOV AH, 0
- INT 16h
-
- ; print the key:
- MOV AH, 0Eh
- INT 10h
-
- ; press 'ESC' to exit:
- CMP AL, 1Bh
- JZ exit
-
- JMP wait_for_key
- ;============================
-
- exit:
- RET
-
- DEFINE_PRINT_STRING
-
- msg1 DB 'Type anything...', 13, 10
- DB '[Enter] - carriage return.', 13, 10
- DB '[Ctrl]+[Enter] - line feed.', 13, 10
- DB 'You will hear a beep', 13, 10
- DB ' when buffer is overflown.', 13, 10
- DB 'Press ESC to exit.', 13, 10, 0
-
- END
-